// 在组件或其他模块中使用
import axiosInstance from './axiosInstance';

async function getPlayAuth(vodId) {
    const url = 'https://vod.cn-shanghai.aliyuncs.com/?Action=GetPlayInfo&VideoId=' + vodId;
	const params = {
        AccessKeyId: 'LTAI5tQddnxKoogtF9Aj2ZNn',
        AccessKeySecret: 'C3WKaCa15vYrJ2H5YGsWRUg9CmFBiv',
        SignatureMethod: 'HMAC-SHA1',
        SignatureVersion: '1.0',
        Timestamp: new Date().toISOString(),
        Format: 'JSON'
    };

    try {
        const response = await axiosInstance.get(url, { params });
        console.log('视频点播：', response);
        return response.data.PlayInfoList.PlayInfo[0].PlayURL;
    } catch (error) {
        console.error('获取 PlayAuth 失败', error);
        return null;
    }
}
export default getPlayAuth;